package com.xpsoft.oa.dao.project.impl;


import org.hibernate.Query;

import com.xpsoft.core.dao.impl.BaseDaoImpl;
import com.xpsoft.oa.dao.project.ContractDao;
import com.xpsoft.oa.model.project.Contract;

public class ContractDaoImpl extends BaseDaoImpl<Contract> implements ContractDao{

	public ContractDaoImpl() {
		super(Contract.class);
	}

	@Override
	public String getMaxNo(String search) {
		String hql = "select contractNo from Contract where contractNo like "+"'%"+search+"%'"+" order by contractNo desc";
		Query query = getSession().createQuery(hql);
		String contractNo = (String)query.setFirstResult(0).setMaxResults(1).setFetchSize(1).uniqueResult();
		return contractNo;
	}


}